package com.xyzwps.harbor.repo;

import com.xyzwps.harbor.model.VcodeScope;
import org.springframework.data.r2dbc.repository.Modifying;
import org.springframework.data.r2dbc.repository.Query;
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
import org.springframework.stereotype.Repository;
import reactor.core.publisher.Mono;

@Repository
public interface VcodeScopeRepository extends ReactiveCrudRepository<VcodeScope, String> {

    @Modifying
    @Query(""" 
            INSERT INTO vcode_scope (scope, vcode, create_time)
            VALUES (:#{[0].scope}, :#{[0].vcode}, :#{[0].createTime})
            """)
    Mono<Void> insert(VcodeScope scope);
}